<template>
  <router-view />
</template>

<script setup>
import { ref, onMounted, watch } from "vue"
import { useRouter, useRoute } from 'vue-router';
import { useStore } from "@/store"
const store = useStore();
const router = useRouter()

const routerEnum = {
  "#/home": 1,
  "#/buycar": 2,
  "#/me": 3,
}
onMounted(() => {
  console.log(13, location.hash);
  if (localStorage.getItem("token")) {
    store.istoken = true
  }
})
// 监听当前路由
watch(
  () => router.currentRoute.value,
  (newValue) => {
    console.log('newValue', newValue)
    store.tabkey = routerEnum[newValue.href]
  },
  { immediate: true }
)

</script>

<style lang="scss">
@import url("//at.alicdn.com/t/c/font_3435418_wf5imxd5qyq.css");

.wrap {
  padding-top: 50px;
}
</style>
